---@class Battle.BuffHeroEnergyCondition:Battle.IBuffCondition
local t = Battle.CreateClass("BuffHeroEnergyCondition",Battle.IBuffCondition)
Battle.BuffHeroEnergyCondition = t

function t:ctor(buff,energy)
    ---@type Battle.Buffer
    self.buff = buff
    self.energy = energy
    ---@type Battle.Entity
    self.target = nil
    self.camp = self.buff:GetTarget().camp
    self.compare = Battle.CompareType.GreaterEquals
end

function t:Check()
    self.target = self.data[1]
    if self.target == nil then
        logError("[BuffHeroEnergyCondition]缺少参数比较")
        return false
    end
    if self.target.camp ~= self.camp then
        return false
    end
    local cfg = DataTable.GetById("t_hero", self.target.modelId)
    return Battle.BattleUtil.CheckCondition(cfg.f_ConsumeEnergy,self.compare,self.energy)
end
